package com.itibo.services;

import java.io.File;

import java.io.FileNotFoundException;

import com.itibo.models.CSVDocument;
import com.itibo.models.Document;
import com.itibo.models.Song;
import com.itibo.models.SongCollection;

public class SongWriter {
    Document newDoc;

    public SongWriter(Document doc){
        newDoc = doc;
    }
    private void writeOneSong(Song currentSong){
        String[] obj = new String[]{
                currentSong.getName(),
                currentSong.getAuthor(),
                currentSong.getGenres(),
                currentSong.getYear()
        };
        newDoc.writeObject(obj);
    }

    public void putSongCollection(SongCollection songCollection) {
        for(Song song : songCollection.getMySongs()) {
            writeOneSong(song);
        }
    }
}
